<?php

$url = 'http://japi.zto.cn/traceInterfaceNewTraces';
$company_id = '4389a0311c9d4a66ad419b9c7f04bdc5';
$key = '4350d83e58c5';
$data = array('data' => '["264662581087"]', 'company_id' => $company_id,
              'msg_type'=>'NEW_TRACES');
$str_to_digest = "";
foreach ($data as $k=>$v) {
  $str_to_digest =$str_to_digest.$k."=".$v."&";
}
$str_to_digest = substr($str_to_digest, 0, -1).$key;
$data_digest = base64_encode(md5($str_to_digest,TRUE));

$options = array(
    'http' => array(
        'header'  => "Content-type: application/x-www-form-urlencoded; charset=utf-8\r\n".
        "x-companyid: ".$company_id."\r\n".
        "x-datadigest: ".$data_digest."\r\n",
        'method'  => 'POST',
        'content' => http_build_query($data)
    )
);

$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;

echo "hehe";

echo "123";
